package com.tmt.im.jpa.entity;

import com.tmt.data.jpa.entity.TmtBaseEntity;
import com.tmt.data.jpa.entity.TmtBaseEntityId;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import java.io.Serial;
import java.io.Serializable;

/**
 * 好友与分组的映射表
 *
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/24 15:09
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "im_friend_group_mapping", description = "好友分组映射表")
@Entity
@Table(name = "im_friend_group_mapping")
public class IMFriendGroupMapping extends TmtBaseEntityId implements Serializable {

    @Serial
    private static final long serialVersionUID = -6510387844939763081L;

    /**
     * 好友对象
     */
    @ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false)
    private IMFriend friend;

    /**
     * 好友分组对象
     */
    @ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false)
    private IMFriendGroup group;

    /**
     * 本条分组映射记录的创建者。
     */
    @ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false)
    private IMUser creator;

}
